<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@include file="/jsp/common/head.jsp"%>

<div class="right">
       <div class="location">
           <strong>你现在所在的位置是:</strong>
           <span>订单管理页面</span>
       </div>
       <div class="search">
       <form id="searchForm" method="post" action="${pageContext.request.contextPath }/billServlet?method=billList">
		<%--  <form id="searchForm" method="get" action="${pageContext.request.contextPath }/billServlet">--%>
			<span>商品名称：</span>
			<%-- get请求不能拼接参数，可以将参数隐藏在表单中 --%>
			<%--  <input name="method" type="hidden" value="billList">  --%>
			<input name="queryProductName" type="text" value="${(pageSupport.callBackInfo)[0]}">
			 
			<span>供应商：</span>
		   <select name="queryProviderId">
			   <option value="0">--请选择--</option>
			   <c:forEach items="${provideList}" var="provide">
				   <option value="${provide.id}" <c:if test="${(pageSupport.callBackInfo)[1] == provide.id }" > selected </c:if>>--${provide.proName}--</option>
			   </c:forEach>
		   </select>
			 
			<span>是否付款：</span>
			<select name="queryIsPayment">
				<option value="0" >--请选择--</option>
				<option value="1" <c:if test="${(pageSupport.callBackInfo)[2] == '1' }" > selected </c:if>>未付款</option>
				<option value="2" <c:if test="${(pageSupport.callBackInfo)[2] == '2' }" > selected </c:if>>已付款</option>
       		</select>
			   <!-- 当前页面参数 和 页面容量-->
			   <input type="hidden" name="pageNo" id="pageNo" value="${pageSupport.currPageNo == null ? 1 : pageSupport.currPageNo}"/>
			   <input type="hidden" name="pageSize" id="pageSize" value="${pageSupport.pageSize == null ? 5 : pageSupport.pageSize}"/>
			   <!-- 当前排序字段 和 排序方式-->
			   <input type="hidden" name="orderBy" id="orderBy" value="${pageSupport.orderBy == null ? 'id' : pageSupport.orderBy}"/>
			   <input type="hidden" name="ascOrDesc" id="ascOrDesc" value="${pageSupport.ascOrDesc == null ? 'asc' : pageSupport.ascOrDesc}"/>
			 <input	value="查 询" type="submit" id="searchbutton">
			 <a href="${pageContext.request.contextPath }/jsp/billadd.jsp">添加订单</a>
		</form>
       </div>
       <!--账单表格 样式和供应商公用-->
      <table class="providerTable" cellpadding="0" cellspacing="0">
          <tr class="firstTr">
              <th width="10%">订单编码</th>
              <th width="20%">商品名称</th>
              <th width="20%">供应商</th>
              <th width="10%">订单金额</th>
              <th width="10%">是否付款</th>
              <th width="10%">创建时间</th>
              <th width="20%">操作</th>
          </tr>
          	<c:forEach items="${pageSupport.data}" var="bill">
				<tr>
					<td>
					<span>${bill.billCode}</span>
					</td>
					<td>
					<span>${bill.productName}</span>
					</td>
					<td>
					<span>
						<!-- 遍历供应商列表 -->
						<c:forEach items="${provideList}" var ="provide" varStatus="status">
							<!-- 根据 订单的 providerId 匹配 provider 的 id 获取 proName -->
							<c:if test="${ bill.providerId  eq provide.id}" var="flag">
								<span>${provide.proName}</span>
							</c:if>
						</c:forEach>
					</span>
					</td>
					<td>
					<span>${bill.totalPrice}</span>
					</td>
					<td>
					<span>
						<span>${user.gender == 1 ? "付款" : "未付款"}</span>
					</span>
					</td>
					<td>
					<span>
						${bill.creationDate}
					</span>
					</td>
					<td>
					<span><a class="viewBill"   href="${pageContext.request.contextPath }/billServlet?method=billInfo&id=${bill.id}" ><img src="${pageContext.request.contextPath }/images/read.png" alt="查看" title="查看"/></a></span>
					<span><a class="modifyBill" href="${pageContext.request.contextPath }/billServlet?method=toBillMod&id=${bill.id}" ><img src="${pageContext.request.contextPath }/images/xiugai.png" alt="修改" title="修改"/></a></span>
					<span><a class="deleteBill" href="${pageContext.request.contextPath }/billServlet?method=billDel&id=${bill.id}" onClick="return confirm('是否确认删除${bill.billCode}订单')" ><img src="${pageContext.request.contextPath }/images/schu.png" alt="删除" title="删除"/></a></span>
					</td>
				</tr>
			</c:forEach>
      </table>
	<c:import url="rollpage.jsp"></c:import>
  </div>
</section>
<%@include file="/jsp/common/foot.jsp" %>